function userChangePass(forma){
	els = forma.elements;
	var old = els["oldpass"];
	var new1= els["newpass1"];
	var new2= els["newpass2"];
	
	if(!new1.value || !new2.value || !old.value){
		return;
	}
	
	if(new1.value.length<6){
		alert("Lozinka je kratka!\nMinimum: 6 karaktera.");
		return;
	}
	
	if(new1.value != new2.value){
		alert("Uneta nova lozinka u drugom polju nije ista kao u prvom!");
		return;
	}
	var action = "a=changePass&s=1";
	action += "&old="+old.value;
	action += "&new="+new1.value;
	LoadRSDoc("user.php","afterUserChangePass",action,'',1);
}
function afterUserChangePass(response){
	var tmp = response.split("{!}");
	var code = tmp[0];
	var msg = tmp[1];
	alert(msg);
	if(code>0){
		logout();
	}
}
function addNewUser(forma){
	var els = forma.elements;
	var radnik = els["radnik"].value;
	var group = els["group"].value;
	var user = els["username"].value;
	var pass1 = els["pass1"].value;
	var pass2 = els["pass2"].value;
	
	if(pass1 !== pass2){
		alert("Unete lozinke nisu iste!");
		return;
	}
	
	LoadRSDoc("user.php?a=addNewUser&radnik="+radnik+"&group="+group+"&user="+user+"&pass="+pass1,"alert");
}